package com.chw.service.impl;

import com.chw.mapp.ValueMapp;
import com.chw.model.Value;
import com.chw.service.ValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ValueServiceImpl implements ValueService {
    @Autowired
  private   ValueMapp valueMapp;

    @Override
    public Object queryValue(Integer id) {
        return valueMapp.queryValue(id);
    }

    @Override
    public void updateValue(Value value) {
        if (value.getIsDel()!=null){
            value.setIsDel(2);
        }
        valueMapp.updateValue(value);
    }

    @Override
    public void addValue(Value value) {
        value.setCreateDate(new Date());
        value.setIsDel(1);
        valueMapp.addValue(value);
    }
}
